package net.lesscoding;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;
import io.netty.channel.embedded.EmbeddedChannel;
import io.netty.handler.logging.LogLevel;
import io.netty.handler.logging.LoggingHandler;
import net.lesscoding.message.LoginRequestMessage;
import net.lesscoding.protocol.MessageCodec;
import org.junit.Test;

/**
 * @author eleven
 * @date 2024/10/31 9:36
 * @apiNote
 */

public class MessageCodecTest {

    @Test
    public void messageCodecTest() {
        EmbeddedChannel channel = new EmbeddedChannel(
                new LoggingHandler(LogLevel.DEBUG),
                new MessageCodec()
        );
        // encode
        LoginRequestMessage loginRequestMessage = new LoginRequestMessage("username", "password");
        channel.writeOutbound(loginRequestMessage);
        // decode
        ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer();
    }
}
